/**
 * Created by yongzhi on 2015/3/23.
 */
define(['common/js/boss-frame-angular-dev-0.1'],function() {
    //var mplusUiDirectives = angular.module("mplus.ui.directives", []);
    //var mplusUiFilters = angular.module("mplus.ui.filters", []);
    //var mplusUiServices = angular.module("mplus.ui.services", []);
    //
    //var mplusUi = angular.module("mplus.ui", ["mplus.ui.directives", "mplus.ui.filters", "mplus.ui.services"]);

    // 树形结构展示
    diretiveModule.directive("plusTree", ["$compile", function ($compile) {
        return {
            scope: true,
            restrict: "E",
            replace: true,
            transclude: true,
            controller: function ($scope) {
            },
            templateUrl: "common/js/html/mplusTree1.html",
            compile: function (tElm, tAttrs) {
                var dataS = tAttrs.data;
                var contentTemplateS = tAttrs.contentTemplate;
                var entityDefS = tAttrs.entityDef;

                return {
                    post: function (scope, elm, attrs) {
                        scope.data = scope[dataS];
                        scope.entityDef = scope[entityDefS];

                        if (angular.isFunction(scope[contentTemplateS])) {
                            scope.contentTemplate = scope[contentTemplateS]();
                        } else {
                            scope.contentTemplate = scope[contentTemplateS];
                        }
                    }
                };
            }
        };
    }]);
    diretiveModule.directive("treeContent", ["$compile", function ($compile) {
        return {
            scope: true,
            restrict: "E",
            replace: true,
            require: '^plusTree',
            compile: function (tElm, tAttrs) {
                return {
                    pre: function (scope, elm, attrs) {
                        scope.entity = scope[attrs.entity];

                        var contentTemplate = $(scope.contentTemplate);
                        elm.append(contentTemplate);
                        $compile(contentTemplate)(scope);
                    }
                };
            }
        };
    }]);
    diretiveModule.directive("natureBox",[function(){
        return {
            restrict: "EAC",
            replace: false,
            scope: {
                natureBox: "@natureBox"
            },
            link: function(scope, elm, attrs) {
                var setHeight = "200px";
                if(scope.natureBox != undefined) {
                    setHeight = scope.natureBox;
                }
                
                $(elm).slimscroll({
                    height: setHeight
                });
                elm.parent().css('height','auto');
            }
        }
    }]);

    //return mplusUi;
});